<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="https://ajax4jsf.dev.java.net/ajax"
	xmlns:rich="http://richfaces.org/rich"
	template="../include/template.xhtml">

	<ui:define name="title">
		<h:outputText value="角色--" />
	</ui:define>

	<ui:define name="content">
		<style type="text/css">
<!--
.inputClass {
	border: 1px solid #6699CC;
	width: 300px;
	margin-left: 4px;
}
-->
</style>
		<link type="text/css" rel="stylesheet" href="../css/global.css" />
		<br />
		<h:graphicImage value="../images/provider.bmp"></h:graphicImage>
		<h:outputText value="角色分配" class="strong"></h:outputText>
		<rich:separator lineType="double" height="2px" />
		<rich:spacer width="30px"></rich:spacer>
		<s:div styleClass="right_center">
			<s:link value="管理" view="/admin/index.xhtml" />
			<h:outputText value=" --> 用户:#{userDatailAction.user.nickName}" />

		</s:div>

		<s:div styleClass="right_center">
			<h:form id="roleForm">
				<rich:dataTable value="#{roleAction_getRoles}" var="vrole"
					width="100%">
					<rich:column>
						<f:facet name="header">
							<h:outputText value="角色名称" />
						</f:facet>
						<h:outputText value="#{vrole.name}" />
					</rich:column>
					<rich:column>
						<f:facet name="header">
							<h:outputText value="角色描述" />
						</f:facet>
						<h:outputText value="#{vrole.description}" />
					</rich:column>
				</rich:dataTable>

				<a:commandLink id="link" value="添加角色">
					<rich:componentControl for="panel" attachTo="link" operation="show"
						event="onclick" />
				</a:commandLink>
			</h:form>
		</s:div>

		<rich:modalPanel id="panel" width="360" height="160">
			<f:facet name="header">
				<h:panelGroup>
					<h:outputText value="添加角色"></h:outputText>
				</h:panelGroup>
			</f:facet>
			<f:facet name="controls">
				<h:panelGroup>
					<h:outputText value="X" style="cursor:pointer" id="hideLink"></h:outputText>
					<rich:componentControl for="panel" attachTo="hideLink"
						operation="hide" event="onclick" />
				</h:panelGroup>
			</f:facet>
			<h:form>
				<h:outputText value="#{item.name}"></h:outputText>
				<br />
				<h:panelGrid columns="2">
					<h:outputText value="名称" />
					<h:inputText value="#{role.name}" class="inputClass" />
					<h:outputText value="描述" />
					<h:inputTextarea value="#{role.description}" class="inputClass" />
				</h:panelGrid>
				<a:commandButton id="ok" action="#{roleAction.addRole(role)}" styleClass="gbutton"
					value="添加" reRender="roleForm">
					<rich:componentControl for="panel" attachTo="ok" operation="hide"
						event="onclick" />
				</a:commandButton>

			</h:form>
		</rich:modalPanel>

	</ui:define>
</ui:composition>
